/*
 * Copyright 2009 Eat Local Food, LLC
 * Copyright (c) 2007 osCommerce (this file was written after
 * code review of osCommerce).
 *
 * This file is part of gwtCommerce.
 *
 * gwtCommerce is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * gwtCommerce is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gwtCommerce.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.elf.gwt.common.client.model;

import java.util.Date;

import com.google.gwt.json.client.JSONObject;

/**
 *  
 */
public class OrderSummaryModel extends AbstractModel
{
	protected int id;
	protected int offset;
	protected String orderby;
	protected Date datePurchased;
	protected String shipToName;
	protected String status;
	protected double total;
	protected int numberOfProducts;
	protected String currencyCode;
	protected String currencyValue;

	public OrderSummaryModel()
	{
		id = 0;
		offset = 0;
		orderby = "o.orders_id desc";
	}

	public OrderSummaryModel(JSONObject jsonObject)
	{
		this();
		
		id = convertToInteger(jsonObject, "id");
		shipToName = convertToString(jsonObject, "ship_to_name");
		status = convertToString(jsonObject, "status");
		total = convertToDouble(jsonObject, "value");
		datePurchased = convertToDate(jsonObject, "date_purchased");
		numberOfProducts = convertToInteger(jsonObject, "product_number");
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getOffset() {
		return offset;
	}

	public void setOffset(int offset) {
		this.offset = offset;
	}

	public String getOrderby() {
		return orderby;
	}

	public void setOrderby(String orderby) {
		this.orderby = orderby;
	}

	public String getShipToName() {
		return shipToName;
	}

	public String getStatus() {
		return status;
	}

	public double getTotal() {
		return total;
	}

	public Date getDatePurchased() {
		return datePurchased;
	}
	
	public int getNumberOfProducts() {
		return numberOfProducts;
	}
}
